<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML>
<html>
	<head>
		<title>SaySaying校园表白墙</title>
		<link href="/saysaying_my/Public/css/style.css" rel='stylesheet' type='text/css' />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link rel="shortcut icon" type="image/x-icon" href="/saysaying_my/Public/images/fav-icon.png" />
		<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
		</script>
		<!----webfonts---->
		<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700,800' rel='stylesheet' type='text/css'>
		<!----//webfonts---->
		<!-- Global CSS for the page and tiles -->
  		<link rel="stylesheet" href="/saysaying_my/Public/css/main.css">
  		<style type="text/css">
			div{word-break:break-all;word-wrap: break-word;}
			.laud{left:1rem;position: relative;color: #999;}
			.laud:hover{text-decoration:underline}
  		</style>
  		<!-- //Global CSS for the page and tiles -->
		<!---start-click-drop-down-menu----->
		<script src="/saysaying_my/Public/js/jquery.min.js"></script>
        <!----start-dropdown--->
         <script type="text/javascript">
			var $ = jQuery.noConflict();
				$(function() {
					$('#activator').click(function(){
						$('#box').animate({'top':'0px'},500);
					});
					$('#boxclose').click(function(){
					$('#box').animate({'top':'-700px'},500);
					});
				});
				$(document).ready(function(){
				//Hide (Collapse) the toggle containers on load
				$(".toggle_container").hide(); 
				//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
				$(".trigger").click(function(){
					$(this).toggleClass("active").next().slideToggle("slow");
						return false; //Prevent the browser jump to the link anchor
				});
									
			});
		</script>
        <!----//End-dropdown--->
		<!---//End-click-drop-down-menu----->
	</head>
	<body>
		<!---start-wrap---->
			<!---start-header---->
			<div class="header">
				<div class="wrap">
				<div class="logo">
					<a href="index.html" style="font-family:'MingLiU';color:#990099"><img src="/saysaying_my/Public/images/logo.png" title="pinbal" /><?php echo ($school); ?>校园表白墙</a>

				</div>
				<div class="nav-icon">
					 <a href="#" class="right_bt" id="activator"><span> </span> </a>
				</div>
				 <div class="box" id="box">
					 <div class="box_content">        					                         
						<div class="box_content_center">
						 	<div class="form_content">
								<div class="menu_box_list">
									<ul>
										<li><a href="<?php echo U('Home/Index/add');?>?do=chk"><span>发布表白</span></a></li>
										
										<!-- <li><a href="<?php echo U('Home/Register/Index');?>"><span>注册</span></a></li> -->
										<li><a href="http://koudaigou.net/f/58ff5b7de7aea93af3d06532"><span>意见反馈</span></a></li>
										<li><a href="<?php echo U('/Home/User/LogOut');?>"><span>退出登录</span></a></li>
										
										<li><a href="contact.html"><span></span></a></li>
										<div class="clear"> </div>
									</ul>
								</div>
								<a class="boxclose" id="boxclose"> <span> </span></a>
							</div>                                  
						</div> 	
					</div> 
				</div>       	  
				<div class="top-searchbar">
					<form>
						<input type="text" /><input type="submit" value="" />
					</form>
				</div>
				<div class="userinfo">
					<div class="user">
						<ul>
							<?php if($flag == false ): ?><li><a href="<?php echo U('Home/Login/Index');?>"><img src="/saysaying_my/Public/images/user-pic.png" title="user-name" /><span>请登录</span></a></li>
							<?php else: ?>
								<li><a href="<?php echo U('Home/User/index');?>"><img src="<?php echo ($headImgSrc); ?>" title="user-name" style="width:2.5rem;height:2.5rem;" /><span>个人中心</span></a></li><?php endif; ?>
						</ul>
					</div>
				</div>
				<div class="clear"> </div>
			</div>
		</div>
		<!---//End-header---->
        <div class="copyrights">Collect from <a href="http://www.cssmoban.com/" >ÆóÒµÍøÕ¾Ä£°å</a></div>
		<!---start-content---->
		<div class="content">
			<div class="wrap">
			 <div id="main" role="main">
			      <ul id="tiles" style="border:1px solid red;">

			        <!-- These are our grid blocks -->
			       		<?php if(is_array($data['contents'])): foreach($data['contents'] as $key=>$val): ?><li onClick='location.href="<?php echo U('/Home/Index/singleSay',array('pid'=>$val['id']));?>";'>  
					         
					        	<!-- <img src="images/img1.jpg" width="200" height="200"> -->

					        	<!-- ÎÄ×ÖÇøÓò -->
					        	<div class="post-info">

					        		<!-- Í·²¿ -->
					        		<div class="post-header-info">

					        			<h3 class="to">TO : <?php echo ($val["content_to"]); ?></h3>

					        			<h4 class="time"><?php echo (date("Y-m-d H:i",$val["intime"])); ?></h4>

					        		</div>	 
									<!-- Í·²¿end       	 -->

					        		<!-- ÄÚÈÝ       	 -->
					        		<div class="post-basic-info">
						        		<!-- <h3><a href="#">Animation films</a></h3> -->
						        		<!-- <span><a href="#"><label> </label>Movies</a></span> -->
						        		<p ><?php echo ($val["content"]); ?></p>

						        		<h3 class="from">Form: <?php echo ($val["ssid"]); ?></h3>
					        		</div>
									<!-- ÄÚÈÝend       	 -->

					        		<!-- ·ÖÏíÀ¸ -->
					        		<div class="post-info-rate-share">
					        			<p>
											<a href="javascript:;" class="laud" name="<?php echo ($val["id"]); ?>" type="1"> 点赞(<span><?php echo ($val["laud"]); ?></span>)</a>
					         								          
										</p>
					        			<!-- <div class="rateit">
					        				<span> </span>
					        			</div>
					        			<div class="post-share">
					        				<span> </span>
					        			</div>
					        			<div class="clear"> </div> -->
					        		</div>
					        		<!-- ·ÖÏíÀ¸end -->
					        	</div>
					        	<!-- ÎÄ×ÖÇøÓòend -->
					        </li><?php endforeach; endif; ?>   

			        <!-- End of grid blocks -->
			      </ul>
			    </div>
			</div>
		</div>
		<!---//End-content---->
		<!----wookmark-scripts---->
		  <script src="/saysaying_my/Public/js/jquery.imagesloaded.js"></script>
		  <script src="/saysaying_my/Public/js/jquery.wookmark.js"></script>
		  <script type="text/javascript">
		    (function ($){
		      var $tiles = $('#tiles'),
		          $handler = $('li', $tiles),
		          $main = $('#main'),
		          $window = $(window),
		          $document = $(document),
		          options = {
		            autoResize: true, // This will auto-update the layout when the browser window is resized.
		            container: $main, // Optional, used for some extra CSS styling
		            offset: 20, // Optional, the distance between grid items
		            itemWidth:280 // Optional, the width of a grid item
		          };
		      /**
		       * Reinitializes the wookmark handler after all images have loaded
		       */

		      function applyLayout() {
		        $tiles.imagesLoaded(function() {
		          // Destroy the old handler
		          if ($handler.wookmarkInstance) {
		            $handler.wookmarkInstance.clear();
		          }
		
		          // Create a new layout handler.
		          $handler = $('li', $tiles);
		       
		          $handler.wookmark(options);
		        });
		      }
		      /**
		       * When scrolled all the way to the bottom, add more tiles
		       */

		       var flag= true; 

		      function onScroll(){
		        // Check if we're within 100 pixels of the bottom edge of the broser window.
		        var winHeight = window.innerHeight ? window.innerHeight : $window.height(), // iphone fix
		            closeToBottom = ($window.scrollTop() + winHeight > $document.height() - 100);
				
		        
		        if (closeToBottom) {

		          // Get the first then items from the grid, clone them, and add them to the bottom of the grid
		          var $items = $('li', $tiles);

		         

		          // var  $firstTen = $items.slice(0, 10);
		          var $current_count=$items.length;
		          // alert($current_count);


		          if(flag){ 
		          	    flag=false;
		          		$.post('<?php echo U("Home/Index/wookmarkAdd");?>',{current_count:$current_count},function(res){
			           		// alert(res);
			           		// console.log(res);
			           		$tiles.append(res);
			           		flag=true;

			           		// 瀑布流新增的li重新绑定点赞事件
			           		
				           		$('.laud').on('click',function(event){
							    	// alert(event);
							    	// console.log(event);
							 		//阻止事件冒泡函数 
									function stopBubble(e){ 
										if (e && e.stopPropagation){

											e.stopPropagation() 
										}else{
										  window.event.cancelBubble=true;
										}										
									} 

							      stopBubble(event);
							      var id = $(this).attr('name');
							      var laud = $(this).find('span').text();
							      if($(this).attr('type') == 1){
							        laud = parseInt(laud) + 1;
							        // $(this).find('span').html(laud);
							        $(this).html("取消点赞("+ "<span>" + laud + "</span>" +")");
							        // $(this).css('color','#999');
							        $(this).attr('type',2);
							        $.post('/saysaying_my/index.php/Home/Index/laud',{id:id,type:1},function(){
							        	  
							        })  
							      }else{
							        laud = parseInt(laud) - 1;
							        // $(this).find('span').html(laud);
							        $(this).html("点赞("+ "<span>" + laud + "</span>" +")");
							        // $(this).css('color','#999');
							        $(this).attr('type',1);
							        $.post('/saysaying_my/index.php/Home/Index/laud',{id:id,type:2},function(){

							        })
							      }
							    })

						 // 瀑布流新增的li重新绑定点赞事件
	       				})
		          }
			           
		                 
		          // $tiles.append($firstTen.clone());
		
		          applyLayout();
		        }
		      };
		
		      // Call the layout function for the first time
		      applyLayout();
		
		      // Capture scroll event.
		      $window.bind('scroll.wookmark', onScroll);
		    })(jQuery);
		  </script>
		<!----//wookmark-scripts---->
		<!----start-footer--->
		<div class="footer">
			<p>Copyright &copy; 2015.Company name All rights reserved.More Templates <a href="http://www.cssmoban.com/" target="_blank" title="saysaying">saysaying</a> - Collect from <a href="http://www.cssmoban.com/" title="哈库拉玛塔塔" target="_blank">哈库拉玛塔塔</a></p>
		</div>
		<!----//End-footer--->
		<!---//End-wrap---->


		<!-- 评论和点赞 -->

		<script type="text/javascript">
		      
			  $(function(){
			    

			    //赞
			    $('.laud').on('click',function(event){
			    	laud($(this),event);
			    })

			    function laud(dom,e){
			    	// alert(event);
			    	// console.log(event);
			 	
			      stopBubble(e);
			      var id = dom.attr('name');
			      var laud = dom.find('span').text();
			      if(dom.attr('type') == 1){
			        laud = parseInt(laud) + 1;
			        // $(this).find('span').html(laud);
			        dom.html("取消点赞("+ "<span>" + laud + "</span>" +")");
			        // $(this).css('color','#999');
			        dom.attr('type',2);
			        $.post('/saysaying_my/index.php/Home/Index/laud',{id:id,type:1},function(){

			        })  
			      }else{
			        laud = parseInt(laud) - 1;
			        // $(this).find('span').html(laud);
			        dom.html("点赞("+ "<span>" + laud + "</span>" +")");
			        // $(this).css('color','#999');
			        dom.attr('type',1);
			        $.post('/saysaying_my/index.php/Home/Index/laud',{id:id,type:2},function(){
			        })
			      }
			    }

			    //赞结束
			  
			    //阻止事件冒泡函数 
				function stopBubble(e){ 
					if (e && e.stopPropagation){

						e.stopPropagation() 
					}else{
					  window.event.cancelBubble=true;
					}
					
				} 


			  })

		</script>

		<!-- 评论和点赞 end-->





	</body>
</html>